home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / CHASSIS_ / WHICHWIN.C < prev    next >
Text File  |  1992-05-14  |  931b  |  23 lines

  1. /************************************************************************************/
  2. /*    WhichWindow                                                                        */
  3. /*    This routine matches a WindowPtr with an entry in the window table windTbl,    */
  4. /*  returning the subscript of the entry.  Return code is one if a match is not        */
  5. /*  found and zero if a match is found.                                                */
  6. /************************************************************************************/
  7.  
  8. #include "MyHeaders.h"
  9.  
  10. int WhichWindow(WindowPtr WhichWindPtr, int * WhichSubscript)
  11. {
  12.     int        WhichWindRetCode = 1;                /* default return code is bad        */
  13.     
  14.     for (j=0; j<windMax; j++)                    /* check the table for..             */
  15.         if (WhichWindPtr == windTbl[j].windPtr)    /* ..a match with pointer            */ 
  16.             {                                    /* if there is a hit..                */
  17.             *WhichSubscript = j;
  18.             WhichWindRetCode = 0;                /*   set return code to good        */
  19.             break;                                /*   get out of the loop            */
  20.             }
  21.  
  22.     return WhichWindRetCode;
  23. }